1 using System.Collections;
2 using
System.Collections.Generic;
3 using
UnityEngine;
4
5 public
class CrossMovement : Movement, IPieceMovement {
6
7
8     
public CrossMovement(GCPlayer player, Piece piece) : base(player,piece) {
9         BoundComputations += ComputeBound;
10     }
11
12     
public override void ComputeBound() {
13         Node currNode = piece.Node;
14         
int origRow = currNode.row;
15         
int origCol = currNode.col;
16
17         Grid grid = GameManager.Instance.Grid;
18
19         
for (int row = -1; row <= 1; row++) {
20             
for (int col = -1; col <= 1; col++) {
21                 
if (row == 0 && col == 0) continue;
22
23                 
int newRow = origRow + row;
24                 
int newCol = origCol + col;
25                 ComputeMoveOrEatPiece(grid.GetNodeAt(newRow, newCol));
26             }
27         }
28     }
29
30 }


Gõ tìm kiếm nhanh...